package cn.ys.base.config;

import cn.ys.base.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.xml.ws.Action;

// 登录拦截配置类
@Configuration
public class LoginConfig implements WebMvcConfigurer{

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加拦截器类
        registry.addInterceptor(loginInterceptor)
                // 配置拦截所有
                .addPathPatterns("/**")
                // 配置放行接口
                .excludePathPatterns(
                  "/login/**",
                  "/verifyCode/**",
                  "/shop/settlement/**",
                  "/fastdfs/**",
                  "/shop/activity/**"
                );
    }
}
